package org.gdpu.model;

import javax.persistence.*;

/**
 * Created by HEWI2 on 12/19/13.
 */
@Entity
public class Major {

    /**
     * 专业编号
     */
    private int majorId;

    /**
     * 专业名称
     */
    private String majorName;
    /**
     * 学院
     */
    private College college;


    @Id
    public int getMajorId() {
        return majorId;
    }

    public void setMajorId(int majorId) {
        this.majorId = majorId;
    }

    @Column(nullable = false, length = 30)
    public String getMajorName() {
        return majorName;
    }

    public void setMajorName(String majorName) {
        this.majorName = majorName;
    }

    @ManyToOne
    @JoinColumn(name = "collegeId",nullable = false)
    public College getCollege() {
        return college;
    }

    public void setCollege(College college) {
        this.college = college;
    }

    public Major(String majorName) {
        super();
        this.majorName = majorName;
    }

    public Major() {
        super();
    }

    @Override
    public String toString() {
        return majorName;
    }
}
